package cn.tedu.boot31.mapper;

import cn.tedu.boot31.entity.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Classname: ProductMapper
 * @Author: bromide
 * @CreateTime: 2022/5/12--10:17
 * @Version: V1.0
 * @Description:
 */
@Mapper
public interface ProductMapper {
    @Insert("insert into product values(null,#{title},#{price},#{saleCount})")
    void insert(Product product);

    @Select("select * from product")
    @Result(column = "sale_count",property = "saleCount")
    List<Product> select();

    @Update("update product set title=#{title},price=#{price},sale_count=#{saleCount}")
    void update(Product product);

    @Delete("delete from product where title=#{title}")
    void delete(String title);
}
